package com.test.reggie.model.fragment.mycentent;

import com.test.reggie.base.BaseObserver;
import com.test.reggie.base.BasePresenter;
import com.test.reggie.bean.StringBean;
import com.test.reggie.bean.UserBean;

public class MyCenterPrensenter extends BasePresenter<MyCenterView> {
    public MyCenterPrensenter(MyCenterView baseView) {
        super(baseView);
    }

    /**
     * 退出登录
     */
    public void logout() {
        addDisposable(apiServer.logout(), new BaseObserver<StringBean>() {
            @Override
            public void onSuccess(StringBean bean) {
                baseView.logoutData(bean);
            }

            @Override
            public void onError(String msg) {
                baseView.onError(msg);
            }
        });
    }

    /**
     * 根据id查询员工信息
     *
     * @param id
     */
    public void userDetails(String id) {
        addDisposable(apiServer.userDetails(id), new BaseObserver<UserBean>() {
            @Override
            public void onSuccess(UserBean bean) {
                baseView.userDetailsSuccess(bean);
            }

            @Override
            public void onError(String msg) {
                baseView.onError(msg);
            }
        });
    }
}
